package adminapilogic

import (
	v1 "code.bydev.io/cht/customer/kyc-stub.git/pkg/bybit/kyc/admin/v1"
	"code.bydev.io/cht/customer/kyc_admin_service/internal/app/serv"
	"code.bydev.io/cht/customer/kyc_admin_service/service/private/internal/svc"
	"context"
	pb "git.bybit.com/svc/stub/pkg/pb/api/kycadmin"
)

type AdminAPIAppendLevel2DataLogic struct {
	svcCtx *svc.ServiceContext
}

func NewAdminAPIAppendLevel2DataLogic(
	svcCtx *svc.ServiceContext,
) *AdminAPIAppendLevel2DataLogic {
	return &AdminAPIAppendLevel2DataLogic{
		svcCtx: svcCtx,
	}
}

// 增加补Lv2数据接口
func (l *AdminAPIAppendLevel2DataLogic) AppendLevel2Data(
	ctx context.Context,
	in *v1.AppendLevel2DataRequest,
) (*v1.AppendLevel2DataResponse, error) {
	oldResp, err := serv.NewService(l.svcCtx.NothingEnv).
		AppendLevel2Data(ctx, &pb.AppendLevel2DataRequest{MemberId: in.GetMemberId()})
	if err != nil {
		return nil, err
	}
	return &v1.AppendLevel2DataResponse{
		Result: oldResp.GetResult(),
	}, nil
}
